import hashlib


def string_to_md5(string, code_enable='utf-8'):
    md5_val = hashlib.md5(string.encode(code_enable)).hexdigest()
    return md5_val
